/**
 * <pre>
 * @(#)DemoBufferView.java 1.00 2009-11-27
 * 
 * Copyright (c) 1998, 2009 Regular Individual. All rights reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Contributor(s):
 *     Haixu Huang
 * </pre>
 **/
package _test_;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import cn.sh.huang.chart.view.BufferView;

/**
 * <pre>
 * DemoBufferView ...
 * 
 * @version 1.0
 * </pre>
 */
abstract class DemoBufferView extends BufferView
{
    public Dimension getMinimumSize()
    {
        return getPreferredSize();
    }

    protected void renderBuffer(Graphics2D g2d)
    {
        Dimension viewSize = getViewSize();
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setColor(Color.WHITE);
        g2d.fillRect(0, 0, viewSize.width - 1, viewSize.height - 1);
        g2d.setColor(Color.BLACK);
        g2d.drawLine(0, 0, viewSize.width - 1, viewSize.height - 1);
        g2d.drawLine(0, viewSize.height - 1, viewSize.width - 1, 0);
        g2d.drawRect(0, 0, viewSize.width - 1, viewSize.height - 1);
    }
}

class ContentView extends DemoBufferView
{
    public Dimension getPreferredSize()
    {
        return new Dimension(1280, 320);
    }
}

class VertBarView extends DemoBufferView
{
    public Dimension getPreferredSize()
    {
        return new Dimension(150, 320);
    }
}

class HorzBarView extends DemoBufferView
{
    public Dimension getPreferredSize()
    {
        return new Dimension(1280, 60);
    }
}
